<template>
  <div id="app">
    <dl>
      <dt>
        <a @mouseenter="onTabToggle(0)" :class="activeIndex === 0 ? 'active': ''" href="javascript:void(0)">今日热点</a>
        <a @mouseenter="onTabToggle(1)" :class="activeIndex === 1 ? 'active': ''" href="javascript:void(0)">事实热点</a>
        <a @mouseenter="onTabToggle(2)" :class="activeIndex === 2 ? 'active': ''" href="javascript:void(0)">七日热点</a>
   <!--     <a
          v-for="(item, index) in tabData"
          :key="index"
          @click="onTabToggle(index)"
          :class="activeIndex === index ? 'active': ''"
          href="javascript:void(0)"
        >{{item}}</a>-->
      </dt>
    <!--
     v-if
     v-show
     -->
      <dd>
        <div v-show="activeIndex === 0" class="card">
          <h1>今日热点</h1>
          <h1>今日热点</h1>
          <h1>今日热点</h1>
        </div>
        <div v-show="activeIndex === 1" class="card">
          <p>事实热点</p>
          <p>事实热点</p>
          <p>事实热点</p>
          <p>事实热点</p>
          <p>事实热点</p>
        </div>
        <div v-show="activeIndex === 2" class="card">
          <h3>七日热点</h3>
          <h3>七日热点</h3>
          <h3>七日热点</h3>
          <h3>七日热点</h3>
          <h3>七日热点</h3>
        </div>
      </dd>
    </dl>
  </div>
</template>

<script>

export default {
  name: 'App',
  data() {
    return {
      activeIndex: 0,
      tabData: [
        '今日热点',
        '事实热点',
        '七日热点'
      ]
    }
  },
  methods: {
    onTabToggle(index) {
      // console.log(index)
      this.activeIndex = index
    }
  }
}
</script>

<style>
  * {
    margin: 0;
    padding: 0;
  }
  #app {
    font-family: Avenir, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: #2c3e50;
  }

  dl dt {
    display: flex;
  }

  dl dt a {
    padding: 0 20px;
    margin-right: 10px;
    background: aliceblue;
    line-height: 40px;
    text-decoration: none;
  }

  dl dt a.active {
    background: magenta;
  }

  dl dd .card {
    height: 200px;
    border: 1px solid #ff00ff;
  }
</style>
